﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SpeakOut.Model
{
    [Serializable]
    public class Comment
    {
        public virtual Guid CommentId { get; set; }

        public virtual string Author { get; set; }

        public virtual string Email { get; set; }

        public virtual string Body { get; set; }

        public virtual string Website { get; set; }

        public virtual string Country { get; set; }

        public virtual string Ip { get; set; }

        public virtual bool IsApproved { get; set; }

        public virtual DateTime CreatedAt { get; set; }

        public virtual Post Post { get; set; }

        public Comment()
        {
            CommentId = Guid.Empty;
        }

        private bool Equals(Comment other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.CommentId.Equals(CommentId);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (Comment)) return false;
            return Equals((Comment) obj);
        }

        public override int GetHashCode()
        {
            return CommentId.GetHashCode();
        }
    }
}
